<template>
  <div class="time">
    <ul>
      <li v-for="(item, index) in list" :key="index">
        <span>{{ item.title }}</span>
        <span>{{$timeFilter(item.create_at)}}</span>
      </li>
    </ul>
  </div>
</template>

<script>
import { ref, reactive, toRefs, getCurrentInstance } from "vue";
export default {
  setup() {
    const { proxy } = getCurrentInstance();
    const data = reactive({
      list: [], // 存储请求过来的数据
    });
    proxy.$axios.get("list.json").then((res) => {
      data.list = res.data.data;
    });
    
    return {
      ...toRefs(data)
    };
  },
};
</script>
<style lang="scss" scoped>
li {
  margin-top: 10px;
  padding: 0 10px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  span:first-child{
    width: 30%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
}
</style>